﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Guest/iShopping.Master" AutoEventWireup="true" CodeBehind="HomePage.aspx.cs" Inherits="iShopping.Guest.HomePage" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="iShoppingBUS" %>
<%@ Import Namespace="iShoppingDTO" %>
<asp:Content ID="Content1" ContentPlaceHolderID="main_content" runat="server">
    <div id="center_content" style="min-height:250px;">
        	<div id="left_center_content">
                <div>
		            <ul class="flyout">
		            <li><a href="HomePage.aspx"><b>Home</b></a></li>
		            <%
                        List<LoaiSanPhamDTO> listLoaiSP = null;
                        if (Session["listLoaiSP"] == null)
                        {
                            //LoaiSanPhamBUS lspBUS = new LoaiSanPhamBUS();
                            listLoaiSP = LoaiSanPhamBUS.LayDSLoaiSanPham();
                            Session.Add("listLoaiSP", listLoaiSP);
                        }
                        else
                        {
                            listLoaiSP = (List<LoaiSanPhamDTO>)Session["listLoaiSP"]; 
                        }      
                        for (int i = 0; i < listLoaiSP.Count; i++)
                        {      
		            %>
			            <li><a href="DSSanPham.aspx?value=<%=listLoaiSP[i].MaLoaiSanPham%>"><b><%=listLoaiSP[i].TenLoaiSanPham%></b></a>
			            </li>
                    <%
                        }
                    %>
		            </ul>
	            </div>
            </div>
            <div id="main_center_content" style="background-color:#5177f3; color:#ffffff;">
                <p style="font-size:30px;">Chào mừng đến với iShopping</p>
                <p style="font-size:20px;">Hãy đăng ký ngay</p>
                <a id="register_submit_bt" style="cursor:pointer;"><img src="../images/register.png" /></a>
            </div>
            <div id="right_center_content">
            </div>
        </div>
        <div id="bottom_content">
            <script type="text/javascript">
                var current_point_hot = 0;
                function goBackBtHot() {
                    switch (current_point_hot) {
                        case 8:
                            $(".div_sp_hot_33").hide();
                            $(".div_sp_hot_3").hide(250);
                            $(".div_sp_hot_22").show(250);
                            $(".div_sp_hot_2").show(250);
                            current_point_hot -= 4;
                            break;
                        case 4:
                            $(".div_sp_hot_22").hide();
                            $(".div_sp_hot_2").hide(250);
                            $(".div_sp_hot_1").show(250);
                            current_point_hot -= 4;
                            break;
                    }
                }

                function goForwardBtHot() {
                    switch (current_point_hot) {
                        case 0:

                            $(".div_sp_hot_1").hide(250);
                            $(".div_sp_hot_22").show(250);
                            $(".div_sp_hot_2").show(250);
                            current_point_hot += 4;
                            break;
                        case 4:
                            $(".div_sp_hot_22").hide(250);
                            $(".div_sp_hot_2").hide(250);
                            $(".div_sp_hot_33").show(250);
                            $(".div_sp_hot_3").show(250);
                            current_point_hot += 4;
                            break;
                    }
                }
            </script>
            <!-- block san pham duoc dau gia nhieu nhat -->
            <div>
            	<div style="border:thin;border-color:#A0A0A4; border-style:solid; width:800px;">
                    <div style="background-image:url(/images/bg_hot.png); background-repeat:no-repeat;">
                    	<p style="padding-left: 5px; color:#FFFBF0; font-weight:bold;">Đấu giá nhiều nhất</p>
                    </div>
                    <div id="main_bottom_content" style="height:200px; width:720px; text-align:center;">
                        <div style="float:left;height:80px; width:20px;">
                            <a onclick="goBackBtHot()" style="cursor:pointer;"><img style="padding-top:27px;" src="/images/19-03-2011 1-08-14 Chiều.png" /></a>
                        </div>

                        <div style="float:left; width:680px;">
                            <%
                                List<SanPhamDTO> dssp = SanPhamBUS.getTopBySoLuotDatGia(12);
                                for (int i = 0; i < dssp.Count - 8; i++)
                                {
                                    
                            %>
                            
                            <div class="div_sp_hot_1" style="float:left; padding:0 20px;">
                            	<div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[i].MaSanPham%>"><img height="80" width="80" src="<%=dssp[i].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[i].MaSanPham%>"><%=dssp[i].TenSanPham %></a>
                                </div>
                            	<span>Giá:</span><span style="color:Red;"><%=dssp[i].GiaHienTai %></span>
                            </div>
                            <%
                                }
                            %>
                            
                            <div class="div_sp_hot_22" style="float:left; padding:0 20px; display:none;">
                                <div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[4].MaSanPham%>"><img height="80" width="80" src="<%=dssp[4].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[4].MaSanPham%>"><%=dssp[4].TenSanPham %></a>
                                </div>
                                <span>Giá:</span><span style="color:Red;"><%=dssp[4].GiaHienTai %></span>
                            </div>
                            <%
                                for (int i = 5; i < dssp.Count - 4; i++)
                                {
                            %>
                            <div class="div_sp_hot_2" style="float:left; padding:0 20px; display:none;">
                                <div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[i].MaSanPham%>"><img height="80" width="80" src="<%=dssp[i].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[i].MaSanPham%>"><%=dssp[i].TenSanPham %></a>
                                </div>
                                <span>Giá:</span><span style="color:Red;"><%=dssp[i].GiaHienTai %></span>
                            </div>
                            <%
                                }
                            %>
                            <div class="div_sp_hot_33" style="float:left; padding:0 20px; display:none;">
                                <div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[8].MaSanPham%>"><img height="80" width="80" src="<%=dssp[8].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[8].MaSanPham%>"><%=dssp[8].TenSanPham %></a>
                                </div>
                                <span>Giá:</span><span style="color:Red;"><%=dssp[8].GiaHienTai %></span>
                            </div>
                            <%
                                for (int i = 9; i < dssp.Count; i++)
                                {
                            %>
                            <div class="div_sp_hot_3" style="float:left; padding:0 20px; display:none;">
                                <div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[i].MaSanPham%>"><img height="80" width="80" src="<%=dssp[i].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dssp[i].MaSanPham%>"><%=dssp[i].TenSanPham %></a>
                                </div>
                                <span>Giá:</span><span style="color:Red;"><%=dssp[i].GiaHienTai %></span>
                            </div>
                            <%
                                }
                            %>
                        </div>
                        <div style="float:left; height:80px; width:20px;">
                            <a onclick="goForwardBtHot()" style="cursor:pointer;"><img style="padding-top:27px;" src="/images/19-03-2011 1-07-45 Chiều.png" /></a>
                        </div>
                    </div>
                </div>
            </div>
            <!-- ket thuc block san pham duoc dau gia nhieu nhat -->
            <script type="text/javascript">
                var current_point_new = 0;
                function goBackBtNew() {
                    switch (current_point_new) {
                        case 8:
                            $(".div_sp_moi_33").hide();
                            $(".div_sp_moi_3").hide(250);
                            $(".div_sp_moi_22").show(250);
                            $(".div_sp_moi_2").show(250);
                            current_point_new -= 4;
                            break;
                        case 4:
                            $(".div_sp_moi_22").hide();
                            $(".div_sp_moi_2").hide(250);
                            $(".div_sp_moi_1").show(250);
                            current_point_new -= 4;
                            break;
                    }
                }

                function goForwardBtNew() {
                    switch (current_point_new) {
                        case 0:

                            $(".div_sp_moi_1").hide(250);
                            $(".div_sp_moi_22").show(250);
                            $(".div_sp_moi_2").show(250);
                            current_point_new += 4;
                            break;
                        case 4:
                            $(".div_sp_moi_22").hide(250);
                            $(".div_sp_moi_2").hide(250);
                            $(".div_sp_moi_33").show(250);
                            $(".div_sp_moi_3").show(250);
                            current_point_new += 4;
                            break;
                    }
                }
            </script>
            <%-- block san pham moi --%>
            
            <div style="padding-top:50px;">
            	
            	<div class="sidebox-wrapper sidebox-body-home " id="tabs_home" style="border:thin;border-color:#A0A0A4; border-style:solid; width:800px;">
                	<div style="background-image:url(/images/bg_hot.png); background-repeat:no-repeat;">
                    	<p style="padding-left: 5px; color:#FFFBF0; font-weight:bold;">Sản phẩm mới</p>
                    </div>
                	
                    <div style="height:200px; width:720px; text-align:center; margin-top:10px;">
                        <div style="float:left;height:80px; width:20px;">
                            <a onclick="goBackBtNew()" style="cursor:pointer;"><img style="padding-top:27px;" src="/images/19-03-2011 1-08-14 Chiều.png" /></a>
                        </div>

                        <div style="float:left; width:680px;">
                            <%
                                List<SanPhamDTO> dsSpMoi = SanPhamBUS.getTopByDate(12);
                                for (int i = 0; i < dsSpMoi.Count - 8; i++)
                                {
                                    
                            %>
                            
                            <div class="div_sp_moi_1" style="float:left; padding:0 20px;">
                            	<div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="#"><img height="80" width="80" src="<%=dsSpMoi[i].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dsSpMoi[i].MaSanPham%>"><%=dsSpMoi[i].TenSanPham%></a>
                                </div>
                            	<span>Giá:</span><span style="color:Red;"><%=dsSpMoi[i].GiaHienTai%></span>
                            </div>
                            <%
                                }
                            %>
                            
                            <div class="div_sp_moi_22" style="float:left; padding:0 20px; display:none;">
                                <div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="#"><img height="80" width="80" src="<%=dsSpMoi[4].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dsSpMoi[4].MaSanPham%>"><%=dsSpMoi[4].TenSanPham%></a>
                                </div>
                                <span>Giá:</span><span style="color:Red;"><%=dsSpMoi[4].GiaHienTai%></span>
                            </div>
                            <%
                                for (int i = 5; i < dsSpMoi.Count - 4; i++)
                                {
                            %>
                            <div class="div_sp_moi_2" style="float:left; padding:0 20px; display:none;">
                                <div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="#"><img height="80" width="80" src="<%=dsSpMoi[i].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dsSpMoi[i].MaSanPham%>"><%=dsSpMoi[i].TenSanPham%></a>
                                </div>
                                <span>Giá:</span><span style="color:Red;"><%=dsSpMoi[i].GiaHienTai%></span>
                            </div>
                            <%
                                }
                            %>
                            <div class="div_sp_moi_33" style="float:left; padding:0 20px; display:none;">
                                <div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="#"><img height="80" width="80" src="<%=dsSpMoi[8].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dsSpMoi[8].MaSanPham%>"><%=dsSpMoi[8].TenSanPham%></a>
                                </div>
                                <span>Giá:</span><span style="color:Red;"><%=dsSpMoi[8].GiaHienTai%></span>
                            </div>
                            <%
                                for (int i = 9; i < dsSpMoi.Count; i++)
                                {
                            %>
                            <div class="div_sp_moi_3" style="float:left; padding:0 20px; display:none;">
                                <div class="pict" style="border:thin solid #CCC; text-align:center;">
                                	<a href="#"><img height="80" width="80" src="<%=dsSpMoi[i].HinhAnh %>" /></a>
                                </div>
                                <div class="txt" style="height:70px; width:130px;">
                                	<a style="color:#4C4C4C;" href="ChiTietSanPham.aspx?pgn=1&id=<%=dsSpMoi[i].MaSanPham%>"><%=dsSpMoi[i].TenSanPham%></a>
                                </div>
                                <span>Giá:</span><span style="color:Red;"><%=dsSpMoi[i].GiaHienTai%></span>
                            </div>
                            <%
                                }
                            %>
                        </div>
                        <div style="float:left; height:80px; width:20px;">
                            <a onclick="goForwardBtNew()" style="cursor:pointer;"><img style="padding-top:27px;" src="/images/19-03-2011 1-07-45 Chiều.png" /></a>
                        </div>
                    </div>
				</div>
                
            </div>
            <%-- ket thuc block san pham moi --%>
        </div>
</asp:Content>
